﻿namespace MyAppAPI.Utils
{
    public class AppHelper
    {
        private static IConfiguration _config;
        public AppHelper(IConfiguration config)
        {
            _config = config;
        }
        public static string ReadAppSetting(params string[] sessions)
        {
            try
            {
                if (sessions.Any())
                {
                    return _config[string.Join(":", sessions)];
                }
            }
            catch
            {
                return "";
            }
            return "";
        }
        public static List<T> ReadAppSetting<T>(params string[] session)
        {
            List<T> list = new List<T>();
            _config.Bind(string.Join(":", session), list);
            return list;
        }
    }
}
